import React, { Component } from "react";

class AlgorithmHelper extends Component{
  constructor(props){
    super(props);

    this.init               = this.init.bind(this);
    this.reset              = this.reset.bind(this);
  }

  init(){
    if(this.props.algorithmImp){
      this.props.algorithmImp.init();
      console.log(this.props.algorithmImp);
    }
  }

  reset(){
    if(this.props.algorithmImp){
      this.props.algorithmImp.reset();
    }
  }

  render(){
    return (
      <div className="body">
        <div className="title">{this.props.algorithm?this.props.algorithm.name:''}
          <button hidden={!this.props.algorithmImp} onClick={this.reset}>重置</button>
          <button hidden={!this.props.algorithmImp} onClick={this.init}>刷新</button>
        </div>
        <div className="head">算法描述</div>
        <div id='description'>...</div>
        <div className="head"><label>收集数据</label></div>
        <div id='collect'>...</div>
        <div className="head"><label>准备数据</label></div>
        <div id='prepare'>...</div>
        <div className="head"><label>分析数据</label></div>
        <div id='analysis'>...</div>
        <div className="head"><label>训练算法</label></div>
        <div id='train'>...</div>
        <div className="head"><label>测试算法</label></div>
        <div id='test'>...</div>
        <div className="head"><label>使用算法</label></div>
        <div id='usage'>...</div>
      </div>
    )
  }
}

export default AlgorithmHelper;